package com.member.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizProfileCategory;
import com.member.shop.mapper.SysBizProfileCategoryMapper;
import com.member.shop.service.ISysBizProfileCategoryService;
import com.member.shop.vo.ProfileVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * 资料库分类Service业务层处理
 *
 * @author lixinchen
 * @date 2024-05-08
 */
@Service
public class SysBizProfileCategoryServiceImpl extends ServiceImpl<SysBizProfileCategoryMapper, SysBizProfileCategory> implements ISysBizProfileCategoryService {
    @Resource
    private SysBizProfileCategoryMapper sysBizProfileCategoryMapper;

    /**
     * 查询资料库分类
     *
     * @param id 资料库分类主键
     * @return 资料库分类
     */
    @Override
    public SysBizProfileCategory selectSysBizProfileCategoryById(Long id) {
        return sysBizProfileCategoryMapper.selectById(id);
    }

    /**
     * 查询资料库分类列表
     *
     * @param queryWrapper 资料库分类
     * @return 资料库分类
     */
    @Override
    public List<SysBizProfileCategory> selectSysBizProfileCategoryList(LambdaQueryWrapper<SysBizProfileCategory> queryWrapper) {
        return sysBizProfileCategoryMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizProfileCategory> selectSysBizProfileCategoryList(SysBizProfileCategory sysBizProfileCategory) {
        return sysBizProfileCategoryMapper.selectSysBizProfileCategoryList(sysBizProfileCategory);
    }

    /**
     * 新增资料库分类
     *
     * @param sysBizProfileCategory 资料库分类
     * @return 结果
     */
    @Override
    public int insertSysBizProfileCategory(SysBizProfileCategory sysBizProfileCategory) {
        sysBizProfileCategory.setCreateTime(DateUtils.getNowDate());
        return sysBizProfileCategoryMapper.insert(sysBizProfileCategory);
    }

    /**
     * 修改资料库分类
     *
     * @param sysBizProfileCategory 资料库分类
     * @return 结果
     */
    @Override
    public int updateSysBizProfileCategory(SysBizProfileCategory sysBizProfileCategory) {
        sysBizProfileCategory.setUpdateTime(DateUtils.getNowDate());
        return sysBizProfileCategoryMapper.updateById(sysBizProfileCategory);
    }

    /**
     * 批量删除资料库分类
     *
     * @param ids 需要删除的资料库分类主键
     * @return 结果
     */
    @Override
    public int deleteSysBizProfileCategoryByIds(Long[] ids) {
        return sysBizProfileCategoryMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除资料库分类信息
     *
     * @param id 资料库分类主键
     * @return 结果
     */
    @Override
    public int deleteSysBizProfileCategoryById(Long id) {
        return sysBizProfileCategoryMapper.deleteById(id);
    }
}
